package com.evon.yardmanagement.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

/**
 * Interface for representing the yards.
 * 
 * @author vgaurav
 * 
 */
@Entity
@Table(name = "YARD")
@AttributeOverride(name = "id", column = @Column(name = "YARD_ID"))
public class Yard extends BaseModel implements Serializable {

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return this.name;
	}



	@Column(name = "YARD_NAME")
	private String name;

	@Column(name = "ADDRESS")
	private String address;

	@Column(name = "CITY")
	private String city;

	@Column(name = "PHONE")
	private String phone;

	@Column(name = "DESCRIPTION")
	private String description;

	@Column(name = "ACTIVE")
	private Integer isActive;

	@Column(name = "YARD_TYPE")
	private String yardType;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "yard")
	public Set<Section> sections;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "yard")
	private Set<KeyBin> keyBins;
	
	@OneToOne(mappedBy= "yard", fetch = FetchType.EAGER)
	private YardMapping yardMapping;
	 
	

	public YardMapping getYardMapping() {
		return yardMapping;
	}

	public void setYardMapping(YardMapping yardMapping) {
		this.yardMapping = yardMapping;
	}

	public Set<Section> getSections() {
		return sections;
	}

	public void setSections(Set<Section> sections) {
		this.sections = sections;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int isActive() {
		return isActive;
	}

	public void setActive(int isActive) {
		this.isActive = isActive;
	}
	
	

	public String getYardType() {
		return yardType;
	}

	public void setYardType(String yardType) {
		this.yardType = yardType;
	}



	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 * @return the sections within the
	 */
	// / public List<ISection> getSections();

	/**
	 * 
	 * @return all parking slots within the yard.
	 */
	// public List<IParkingSlot> getParkingSlots();
	/**
	 * 
	 * @return all the key bins belonging to this yard.
	 */

	// public List<IKeyBin> getKeyBins();

}
